package com.framework.view.indicator.indicators.configs;

import android.graphics.Color;

import com.framework.view.indicator.model.IndicatorShapeType;

import java.util.ArrayList;

/**
 * 包裹指示器配置
 *
 * @author liangzx
 * @version 1.0
 * @time 2019-12-13 17:37
 **/
public class WrapIndicatorConfig extends AbstractIndicatorConfig<WrapIndicatorConfig> {

    /**
     * 圆角矩形圆角大小
     */
    private int roundRadius;
    /**
     * 左间距
     */
    private int pendingLeft;
    /**
     * 右间距
     */
    private int pendingRight;
    /**
     * 上间距
     */
    private int pendingTop;
    /**
     * 下间距
     */
    private int pendingBottom;
    /**
     * 是否空心
     */
    private boolean isStroke;
    /**
     * 空心描边宽度
     */
    private int strokeWidth;

    private WrapIndicatorConfig() {
    }

    /**
     * 工厂方法，默认白色圆角矩形
     *
     * @return
     */
    public static WrapIndicatorConfig factory() {
        WrapIndicatorConfig config = new WrapIndicatorConfig();
        config.setShapeType(IndicatorShapeType.ROUND_RECT)
                .setColorFollowSlideChange(true)
                .setPendingLeft(5)
                .setPendingBottom(5)
                .setRoundRadius(10)
                .setColor(Color.WHITE);
        return config;
    }

    @Override
    public WrapIndicatorConfig setShapeType(int shapeType) {
        return super.setShapeType(shapeType);
    }

    @Override
    public WrapIndicatorConfig setColor(int color) {
        return super.setColor(color);
    }

    @Override
    public WrapIndicatorConfig setColors(ArrayList<Integer> colors) {
        return super.setColors(colors);
    }

    @Override
    public WrapIndicatorConfig setColorFollowSlideChange(boolean colorFollowSlideChange) {
        return super.setColorFollowSlideChange(colorFollowSlideChange);
    }

    /**
     * 圆角矩形圆角大小
     *
     * @param roundRadius
     * @return
     */
    public WrapIndicatorConfig setRoundRadius(int roundRadius) {
        this.roundRadius = roundRadius;
        return this;
    }

    /**
     * 四周间距
     *
     * @param panding
     * @return
     */
    public WrapIndicatorConfig setPanding(int panding) {
        this.pendingLeft = panding;
        this.pendingRight = panding;
        this.pendingTop = panding;
        this.pendingBottom = panding;
        return this;
    }

    /**
     * 左间距
     *
     * @param pendingLeft
     * @return
     */
    public WrapIndicatorConfig setPendingLeft(int pendingLeft) {
        this.pendingLeft = pendingLeft;
        return this;
    }

    /**
     * 右间距
     *
     * @param pendingRight
     * @return
     */
    public WrapIndicatorConfig setPendingRight(int pendingRight) {
        this.pendingRight = pendingRight;
        return this;
    }

    /**
     * 上间距
     *
     * @param pendingTop
     * @return
     */
    public WrapIndicatorConfig setPendingTop(int pendingTop) {
        this.pendingTop = pendingTop;
        return this;
    }

    /**
     * 下间距
     *
     * @param pendingBottom
     * @return
     */
    public WrapIndicatorConfig setPendingBottom(int pendingBottom) {
        this.pendingBottom = pendingBottom;
        return this;
    }

    /**
     * 设置是否空心，默认填充
     *
     * @param stroke      是否空心
     * @param strokeWidth 空心描边宽度
     * @return
     */
    public WrapIndicatorConfig setStroke(boolean stroke, int strokeWidth) {
        this.isStroke = stroke;
        this.strokeWidth = strokeWidth;
        return this;
    }

    public boolean isStroke() {
        return isStroke;
    }

    public int getStrokeWidth() {
        return strokeWidth;
    }

    @Override
    boolean isSupportShape(int shapeType) {
        return shapeType == IndicatorShapeType.RECT || shapeType == IndicatorShapeType.ROUND_RECT;
    }

    public int getRoundRadius() {
        return roundRadius;
    }

    public int getPendingLeft() {
        return pendingLeft;
    }

    public int getPendingRight() {
        return pendingRight;
    }

    public int getPendingTop() {
        return pendingTop;
    }

    public int getPendingBottom() {
        return pendingBottom;
    }

    @Override
    public ArrayList<Integer> getColors() {
        return super.getColors();
    }

    @Override
    public int getColor(int position) {
        return super.getColor(position);
    }

    @Override
    public int getColor() {
        return super.getColor();
    }

    @Override
    public boolean isColorFollowSlideChange() {
        return super.isColorFollowSlideChange();
    }
}
